package ming.model.base;

import java.util.Date;
import java.util.UUID;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang.StringUtils;

import ming.util.base.DateUtil;

@SuppressWarnings("serial")
@Entity
@Table(name = "tbfiles", catalog = "")
public class Files implements java.io.Serializable {

	// Fields

	private String id;
	private String name;
	private String path;
	private String desc;
	private String createTime;


	// Property accessors
	@Id
	@Column(name = "vcId", unique = true, nullable = false, length = 36)
	public String getId() {
		if (!StringUtils.isBlank(this.id)) {
			return this.id;
		}
		return UUID.randomUUID().toString();
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "vcName", nullable = false, length = 200)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "vcPath", nullable = false, length = 500)
	public String getPath() {
		return this.path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	@Column(name = "vcDesc", length = 1000)
	public String getDesc() {
		return this.desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	@Column(name = "vcCreateTime", length = 19)
	public String getCreateTime() {
		if (!StringUtils.isBlank(this.createTime)) {
			return this.createTime;
		}else{
			return DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
		}		
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

}